<!--基本信息-->
<!--7政府部门 6 行业协会  3节能公司-->
<div class="tab-pane fade" id="tab-group">
  	<div class="panel-body">
	  	<form class="form-horizontal">
			<div class="form-group">
				<label for="inputName" class="col-xs-3 control-label no_padding_right">公司名称:</label>
				<div class="col-xs-6">
					<input class="form-control input_size" name="company_name" id="inputName" placeholder="" type="text">
				</div>
			</div>

			<div class="form-group">
				<label for="inputPerson" class="col-xs-3 control-label no_padding_right">法人代表:</label>
				<div class="col-xs-3">
					<input class="form-control input_size" name="legal_person" id="inputPerson" placeholder="" type="text">
				</div>
		    </div>

		    <div class="form-group">
				<label for="inputRegist" class="col-xs-3 control-label no_padding_right">公司注册时间:</label>
				<div class="col-xs-6 relative_pos">
					<input class="form-control input_size date-time-picker" name="regist_time" readonly id="inputRegist" placeholder="" type="text">
				</div>
			</div>

			<div class="form-group">
				<label for="inputCapital" class="col-xs-3 control-label no_padding_right">注册资本(万元):</label>
				<div class="col-xs-6 fixed_">
					<input class="form-control input_size" name="regist_capital" id="inputCapital" placeholder="" type="text">
				</div>
			</div>

			<div class="form-group">
				<label for="select" class="col-xs-3 control-label">注册地址</label>
				<div class="col-xs-6">
					<select class="form-control select_size selects" name="regist_province" id="province">
						<option value="-1">请选择</option>
						@foreach ($province as $value)
						<option value="<%$value['area_id']%>"><%$value['area_name']%></option>
						@endforeach
					</select>
					<select class="form-control select_size selects" name="regist_city" id="city">
						<option value="-1">请选择</option>
					</select>

					<select class="form-control select_size selects" name="regist_area" id="area">
						<option value="-1">请选择</option>
					</select>
				</div>
			</div>

			<div class="form-group">
				<label for="inputAddress" class="col-xs-3 control-label no_padding_right">详细地址:</label>
				<div class="col-xs-6">
					<input class="form-control input_size" name="regist_address" id="inputAddress" placeholder="" type="text">
				</div>
			</div>

			<div class="form-group">
				<label for="inputZcode" class="col-xs-3 control-label no_padding_right">邮政编码：</label>
				<div class="col-xs-6">
					<input class="form-control input_size" notRequired="notRequired" name="zcode" id="inputZcode" placeholder="" type="text">
				</div>
			</div>

			<div class="form-group">
				<label for="inputCode" class="col-xs-3 control-label no_padding_right">营业执照注册号：</label>
				<div class="col-xs-3">
					<input class="form-control input_size" name="regist_code" id="inputCode" placeholder="" type="text">
				</div>
			</div>

			<div class="form-group">
				<label for="inputFax" class="col-xs-3 control-label no_padding_right">传真号:</label>
				<div class="col-xs-6">
					<input class="form-control input_size" notRequired="notRequired" name="fax" id="inputFax" placeholder="" type="text">
				</div>
			</div>

			<div class="form-group">
				<label for="inputGroupCode" class="col-xs-3 control-label no_padding_right">组织机构代码:</label>
				<div class="col-xs-6">
					<input class="form-control input_size" name="group_code" id="inputGroupCode" placeholder="" type="text">
				</div>
			</div>

			<div class="form-group">
				<label for="inputContactPerson" class="col-xs-3 control-label no_padding_right">联系人:</label>
				<div class="col-xs-6">
					<input class="form-control input_size" name="contact_person" id="inputContactPerson" placeholder="" type="text">
				</div>
			</div>

			<div class="form-group">
				<label for="inputNumber" class="col-xs-3 control-label no_padding_right">联系人电话:</label>
				<div class="col-xs-6">
					<input class="form-control input_size" name="contact_number" id="inputNumber" placeholder="" type="text">
				</div>
			</div>

			<div class="form-group">
				<label for="inputEmail" class="col-xs-3 control-label no_padding_right">联系人邮箱:</label>
				<div class="col-xs-6">
					<input class="form-control input_size" name="email" id="inputEmail" placeholder="" type="text">
				</div>
			</div>

			<div class="form-group">
				<label class="col-xs-3 control-label no_padding_right">LOGO:</label>
				<div class="col-xs-6">
					<input type="file" name="imgFile" class="uploadImage">
					<input type="hidden" name="logo" class="hiddenName">
					<span class="fileName"></span>
				</div>
			</div>

			<div class="form-group">
				<label for="inputEmail" class="col-xs-3 control-label no_padding_right">机构代码证:</label>
				<div class="col-xs-6">
					<input type="file" name="imgFile" class="uploadImage">
					<input type="hidden" name="group_code_img" class="hiddenName">
					<span class="fileName"></span>
				</div>
			</div>

			<div class="form-group">
				<label for="inputEmail" class="col-xs-3 control-label no_padding_right">营业执照副本:</label>
				<div class="col-xs-6">
					<input type="file" name="imgFile" class="uploadImage">
					<input type="hidden" name="regist_copy" class="hiddenName">
					<span class="fileName"></span>
				</div>
			</div>

			<div class="form-group">
				<label for="inputEmail" class="col-xs-3 control-label no_padding_right">企业办公实景</label>
				<div class="col-xs-6">
					<input type="file" name="imgFile" class="uploadImage">
					<input type="hidden" name="enterprice_pic" class="hiddenName">
					<span class="fileName"></span>
				</div>
			</div>

			<div class="form-group">
				<label class="col-xs-3 control-label no_padding_right">企业性质:</label>
				<div class="col-xs-8">
					<label class="radio-inline">
						<input name="enterprice_char" id="" value="0" checked="" type="radio">
						民营
					</label>
					<label class="radio-inline">
						<input name="enterprice_char" id="" value="1" type="radio">
						国有
					</label>
					<label class="radio-inline">
						<input name="enterprice_char" id="" value="2" type="radio">
						中外合资
					</label>
					<label class="radio-inline">
						<input name="enterprice_char" id="" value="3" type="radio">
						外商独资
					</label>
				</div>
			</div>


			<div class="form-group">
		      <label class="col-xs-3 control-label no_padding_right">描述:</label>
		      <div class="col-xs-6">
		        <textarea class="form-control text_size" name="description" rows="3"></textarea>
		        <span class="help-block"></span>
		      </div>
		    </div>

			<div class="form-group">
				<label for="induction" class="col-xs-3 control-label no_padding_right">简介:</label>
				<div class="col-xs-9">
					<div id="group" style="height:500px;"></div>
				</div>
			</div>

			<div class="form-group">
				<div class="col-xs-12 text-center">
					<button type="button" id="sub" class="btn btn-primary ">提交</button>
				</div>
			</div>
		</dformiv>
	</div>
</div>


<script type="text/javascript">
var ue = UE.getEditor('group');
var  que = "que";
var isAsync;

var loadGroup = true;
$("#showGroup").click(function(){
	if(loadGroup){
		$.getq(que, "get_user_group", {uid : uid}, function (data){
			if(data.success){
				$.each(data.data, function (k, v){
					$("#tab-group input[type='text'][name="+k+"]").val(v);
					$("#tab-group input[type='hidden'][name="+k+"]").val(v);
				})
				$("#tab-group input[type='radio'][name='enterprice_char'][value="+data.data.enterprice_char+"]").attr("checked", "checked");

				$("#tab-group textarea[name='description']").val(data.data.description);
				ue.ready(function(){
				       ue.setContent(decodeURIComponent(data.data.induction));
				   });
				isAsync = false;
				$("#tab-group select[name='regist_province']").val(data.data.regist_province);
				$("#tab-group select[name='regist_province']").change();
				$("#tab-group select[name='regist_city']").val(data.data.regist_city);
				$("#tab-group select[name='regist_city']").change();
				$("#tab-group select[name='regist_area']").val(data.data.regist_area);
				isAsync = true;
				loadGroup = false;
			}
		})
	}
})



$(".uploadImage").AjaxFileUpload({
	path : url + "upload",
	onComplete : function(filename){
			$(this).siblings(".hiddenName").val(filename.filename);
			$(this).siblings(".fileName").html(filename.filename);
		}
	});

$(".selects").change(function(){
	_this = $(this);
	var pid = $(this).val();
	$.ajax({
		url : url + 'address/getarea',
		data : {pid : pid},
		type : "get",
		async: isAsync,
		success:function(data){
			var str = '<option value="-1">请选择</option>';
			$.each(data.area,function(k, v){
				str += '<option value="'+v.area_id+'">'+v.area_name+'</option>';
			})
			_this.next("select").html(str).next("select").html('<option value="-1">请选择</option>');
		}
	})
})

var groupData = {};
$("#tab-group #sub").click(function(){
	$.each($("#tab-group input"), function (k, v){
		groupData[$(v).attr("name")] = $(v).val();
	})
	$.each($("#tab-group select"), function (k, v){
		groupData[$(v).attr("name")] = $(v).val();
	})
	groupData["induction"] = encodeURIComponent(ue.getContent());
	groupData["uid"] = uid;
	groupData["description"] = $("#tab-group textarea[name='description']").val();
	groupData["enterprice_char"] = $("#tab-group input[name='enterprice_char']:checked").val();

	$.post("update_group", groupData, function (data){
		if(data.success){
			success("", "修改成功!");

		}

	})

})



</script>